<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Web指纹识别</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="/lib/layui-v2.5.5/css/layui.css" media="all">
		<link rel="stylesheet" href="/css/public.css" media="all">
		<style>
			.layui-form-item .layui-input-company {
				width: auto;
				padding-right: 10px;
				line-height: 38px;
			}
			.layui-form-item .layui-input-inline {
			    width: 500px;
			}
		</style>
	</head>
	<body>
		<div class="layuimini-container">
			<div class="layuimini-main">

				<fieldset class="table-search-fieldset">
					<div style="text-align:center;vertical-align:middle;">
						<form class="layui-form layui-form-pane" action="">
							<div class="layui-form-item">
								<div class="layui-inline">
									<label class="layui-form-label">URL</label>
									<div class="layui-input-inline">
										<input type="text" name="url" lay-verify="url" autocomplete="off" class="layui-input" placeholder="请输入待识别的URL">
									</div>
								</div>
								<div class="layui-inline">
									<button type="submit" class="layui-btn layui-btn-primary" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i>
										识 别
									</button>
								</div>
							</div>
						</form>
					</div>
				</fieldset>

				<table class="layui-hide" id="BanalyzeTable" lay-filter="currentTableFilter_BanalyzeTable"></table>

			</div>
		</div>
		<script src="/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
		<script>
			layui.use(['form','table'], function() {
				var form = layui.form,
					$ = layui.jquery,
					layer = layui.layer,
					table = layui.table;

				function showLoad() {
					return layer.msg('正在识别中,请稍等...', {icon: 16,shade: [0.5, '#f5f5f5'],scrollbar: false,offset: 'auto', time:100000});
				}

				function closeLoad(index) {
					layer.close(index);
				}

				var loading = showLoad();
				table.render({
					elem: '#BanalyzeTable',
					url: "/api/util/banalyze/scan",
					method: "get",
					cols: [
						[{
								field: 'id',
								width: 70,
								title: 'ID',
								sort: true
							},
							{
								field: 'name',
								width: 230,
								title: '指纹名',
								sort: true
							},
							{
								field: 'description',
								width: 400,
								title: '指纹描述',
							},
							{
								field: 'implies',
								width: 200,
								title: '推断'
							},
							{
								field: 'version',
								minwidth: 400,
								title: '版本信息'
							},
						]
					],
					skin: 'line',
					done : function(res){
						closeLoad(loading);
					},
				});

				// 监听搜索操作
				form.on('submit(data-search-btn)', function(data) {
					var result = JSON.stringify(data.field);
					//执行搜索重载
					table.reload('BanalyzeTable', {
						page: {
							curr: 1
						},
						where: {
							searchParams: result
						}
					}, 'data');

					return false;
				});
			});
		</script>
	</body>
</html>
